<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/27 0027
 * Time: 00:23
 */
namespace app\index\controller;


use think\Db;
use think\Controller;


class Func extends controller{



    //验证码
    public function code(){
        $auth_type = array(
            'register_mobile' => '手机注册'
        );
        $auth_status = array(
            0 => '未处理',
            1 => '验证通过',
            2 => '验证失败'
        );
        $arr = model('VerifyCode')->order('code_id desc')->select();
        $html = '<table border="1"><tr><th>手机号</th><th>验证码</th><th>验证来源</th><th>验证状态</th></tr>';
        foreach ($arr as $key=>$value){
            $html .= "<tr><td>".$value['targetno']."</td><td>".$value['code']."</td><td>".$auth_type[$value['auth_type']]."</td><td>".$auth_status[$value['status']]."</td></tr>";
        }
        $html .= '</table>';
        return $html;
    }


    //充值接口
    public function  setAccount(){

        $mobile = input("mobile");

        $money = floatval(input("money"));

        if(!is_numeric($mobile)){

            return $mobile;
        }

        if($mobile && $money){
            Db::name("user")->where("mobile",$mobile)->setInc("balance",$money);
        }



    }


    //上传图片
    public function upload_act(){

        return action('api/common/upload');

    }



}